package edu.hunau.cxb.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author hb
 * @create 2020-04-15 10:33
 */
@PropertySource(value = {"classpath:emp.properties"})
@Component  //spring组件
@ConfigurationProperties(prefix = "emp")
@Validated  //对数据进行格式校验
public class Emp {
    //@Value("${emp.last-name}")
    @Email
    private String lastName;
    //@Value("${emp.age}")
    private Integer age;
    //@Value("${emp.salary}")
    private double salary;
    //@Value("${emp.boss}")
    private Boolean boss;
    //@Value("${emp.birthday}")
    private LocalDate birthday;
    //@Value("${emp.map}")
    private Map map;
    //@Value("${emp.list}")
    private List list;

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public Boolean getBoss() {
        return boss;
    }

    public void setBoss(Boolean boss) {
        this.boss = boss;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }

    public Emp() {
    }

    @Override
    public String toString() {
        return "Emp{" +
                "lastName='" + lastName + '\'' +
                ", age=" + age +
                ", salary=" + salary +
                ", boss=" + boss +
                ", birthday=" + birthday +
                ", map=" + map +
                ", list=" + list +
                '}';
    }
}
